//
//  MControlCustomzButtonCell.m
//  Mask
//
//  Created by 郭子一 on 2020/10/4.
//  Copyright © 2020 郭子一. All rights reserved.
//

#import "MControlCustomzButtonCell.h"

@interface MControlCustomzButtonCell ()
@property (nonatomic, strong) UIImageView *img;
@property (nonatomic, strong) UILabel *topLabel; //
@property (nonatomic, strong) UILabel *bottomLabel; //
@property (nonatomic, strong) UIButton *addBtn; //
@property (nonatomic, strong) UIButton *deleteBtn; //
@end

@implementation MControlCustomzButtonCell

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.contentView.backgroundColor = UIColor.clearColor;
        [self makeUI];
    }
    return self;
}

///private
- (void)makeUI {
    UIView *view = [[UIView alloc] init];
    view.layer.backgroundColor = [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1.0].CGColor;
    view.layer.shadowColor = [UIColor colorWithRed:93/255.0 green:102/255.0 blue:147/255.0 alpha:0.15].CGColor;
    view.layer.shadowOffset = CGSizeMake(0,2);
    view.layer.shadowOpacity = 1;
    view.layer.shadowRadius = 8;
    view.layer.cornerRadius = 18;
    [self.contentView addSubview:view];
    [view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.offset(3);
        make.centerX.offset(0);
        make.width.height.mas_equalTo(36);
    }];
    
    self.img = [[UIImageView alloc] init];
    self.img.backgroundColor = UIColor.cyanColor;
    [view addSubview:self.img];
    [self.img mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.offset(0);
        make.width.height.mas_equalTo(26);
    }];
    
    self.deleteBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.deleteBtn setImage:[UIImage imageNamed:@"delete"] forState:UIControlStateNormal];
    [self.deleteBtn addTarget:self action:@selector(deleteBtnClick) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:self.deleteBtn];
    [self.deleteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(16);
        make.left.equalTo(view.mas_left).offset(23);
        make.top.offset(3);
        make.height.mas_equalTo(16);
    }];
    
    self.topLabel = [[UILabel alloc] init];
    self.topLabel.text = @"运动";
    self.topLabel.font = JSS_FONT_4;
    self.topLabel.textColor = RGB_VALUE(0x616366);
    self.topLabel.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.topLabel];
    [self.topLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(view.mas_bottom).offset(6);
        make.centerX.offset(0);
        make.height.mas_equalTo(17);
        make.left.right.offset(0);
    }];
    
    self.bottomLabel = [[UILabel alloc] init];
    self.bottomLabel.text = @"按第一次";
    self.bottomLabel.font = JSS_FONT_2;
    self.bottomLabel.textColor = RGB_VALUE(0xC2C7CC);
    self.bottomLabel.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.bottomLabel];
    [self.bottomLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.topLabel.mas_bottom).offset(3);
        make.centerX.offset(0);
        make.height.mas_equalTo(17);
        make.left.right.offset(0);
    }];
    
    self.addBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.addBtn setImage:[UIImage imageNamed:@"add"] forState:UIControlStateNormal];
    [self.addBtn addTarget:self action:@selector(addBtnClick) forControlEvents:UIControlEventTouchUpInside];
    [view addSubview:self.addBtn];
    [self.addBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.offset(0);
        make.width.height.mas_equalTo(26);
    }];
}

- (void)deleteBtnClick
{
    
}

- (void)addBtnClick
{
    
}
@end
